﻿<phone:PhoneApplicationPage
    x:Class="DnD.DeckPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
   
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False"
     Style="{StaticResource TransitionPageStyle}">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <ScrollViewer>
        <Grid x:Name="LayoutRoot" >
            <Grid.Background>
                <ImageBrush  AlignmentX="Center"  AlignmentY="Top"  Stretch="None" ImageSource="{Binding  BackGroundImageSource}" />
            </Grid.Background>
            <Grid.RowDefinitions>
                <RowDefinition Height="39*"/>


                <RowDefinition Height="104*"/>
                <RowDefinition Height="200"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <!--TitlePanel contains the name of the application and page title-->
            <StackPanel Grid.Row="0" Margin="10,0,10,0">
                <TextBlock Text="DECK" Style="{StaticResource PhoneTextNormalStyle}"/>
                <Border BorderThickness="5" Height="79" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" Margin="0,0,0,0" >
                    <TextBlock Text="{Binding SelectedDeck.Name }" Margin="10,0,10,10" Style="{StaticResource CardHeaderTextStyle}"/>
                </Border>

            </StackPanel>
            <!--ContentPanel - place additional content here-->
            <Border Grid.Row="1" BorderThickness="5" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" Margin="30,10,30,0" >
                <Image Source="{Binding SelectedDeck.PictureURL}"  Width="410" Height="300" Stretch="UniformToFill"/>
            </Border>
            <Border Grid.Row="2" BorderThickness="5" BorderBrush="#FFFF9F00" Background="{StaticResource BackgroundColor}" Margin="10,10,10,24" >
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="2*"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0" TextWrapping="Wrap"  Text="{Binding SelectedDeck.Description}" Margin="10,10,10,10" Style="{StaticResource CardDescTextStyle}"/>
                    <Border Grid.Row="1" Margin="309,0,5,5" Background="{StaticResource BorderColor}"  BorderThickness="0" CornerRadius="10">
                        <toolkit:Rating  ReadOnly="True" RatingItemCount="5" Value="{Binding SelectedDeck.Rate}"  Width="125" Height="25" Background="Transparent">
                            <toolkit:Rating.FilledItemStyle>
                                <Style TargetType="toolkit:RatingItem">
                                    <Setter Property="Background" Value="White" />
                                </Style>
                            </toolkit:Rating.FilledItemStyle>
                            <toolkit:Rating.UnfilledItemStyle>
                                <Style TargetType="toolkit:RatingItem">
                                    <Setter Property="Background" Value="{StaticResource BackgroundColor}" />
                                </Style>
                            </toolkit:Rating.UnfilledItemStyle>
                        </toolkit:Rating>
                    </Border>
                </Grid>
            </Border>
            <StackPanel Grid.Row="3">
                <TextBlock Text="CARDS" Style="{StaticResource PhoneTextNormalStyle}"/>
                <phone:LongListSelector  Grid.Row="3" Margin="0,10,-22,2" ItemsSource="{Binding Cards}" SelectionChanged="CardList_SelectionChanged" >
                    <!--<phone:LongListSelector.ListHeaderTemplate>
                        <DataTemplate>
                            <Grid Margin="12,0,0,38">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="*"/>
                                </Grid.RowDefinitions>
                                <TextBlock Text="Cards"
                                           Style="{StaticResource PanoramaItemHeaderTextStyle}"
                                           Grid.Row="0"/>
                            </Grid>
                        </DataTemplate>
                    </phone:LongListSelector.ListHeaderTemplate>-->
                    <phone:LongListSelector.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="140" Width="432" >
                                <!--Replace rectangle with image-->
                                <Border BorderThickness="3" Width="140" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BorderColor}" >
                                    <Image Source="{Binding PictureURL}"  Width="138" Height="138" Stretch="UniformToFill"/>
                                </Border>
                                <!--<Border Margin="8,0,0,0"  BorderThickness="3" Width="275" Height="140" BorderBrush="{StaticResource BorderColor}" Background="{StaticResource BackgroundColor}" >-->

                                <StackPanel Width="311" >

                                    <TextBlock Text="{Binding Name}" TextWrapping="Wrap" Margin="10,0" Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="10,-2,10,0" Style="{StaticResource CardDescTextStyle}" />
                                    <toolkit:Rating ReadOnly="True" RatingItemCount="5" Value="{Binding Rate}"  Width="125" Height="25" Background="Transparent"/>

                                </StackPanel>
                                <!--</Border>-->
                            </StackPanel>
                        </DataTemplate>
                    </phone:LongListSelector.ItemTemplate>
                </phone:LongListSelector>
            </StackPanel>
        </Grid>
    </ScrollViewer>
</phone:PhoneApplicationPage>